package externalSort;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Random;

public class generateBigFile {
    public static void generateLargeFile(String fileName,int sizeOfFile,int maxVal) throws IOException {
        Random random=new Random();
        try(BufferedWriter writer=new BufferedWriter(new FileWriter(fileName))){
            for(int i=0;i<sizeOfFile;i++){
                int num=random.nextInt(maxVal);
                writer.write(num+"\n");
            }
        }
        System.out.println("生成大文件完成");
    }
}
